Ext.require([
    'AM.service.Support',
    'AM.component.menu.MenuItemFactory',
    'AM.data.InitConfig'
]);


Ext.define('AM.component.Text', {


        extend:'Ext.Component',


        xtype:'xbxText',


        constructor:function (config, xbxConfig) {
            var me = this;

            me.callParent(arguments);
            me.initConfig(config);

            me.addListener('render', function () {
                if (!Ext.isEmpty(xbxConfig))
                    AM.data.InitConfig.text(me, xbxConfig);

                me.el.on('click', function () {
                    // disable drag
                    me.dd.disable();
                    me.el.dom.contentEditable = true;
                    me.el.dom.style.borderColor = '#0687FF'
                });

                me.el.on('dblclick', function () {
                    me.el.dom.style.borderColor = 'red'

                    me.dd.enable();
                })

                me.el.on('keyup', function () {
                    AM.service.Thumbnails.refresh(ppt.index);
                })


                var sp = AM.service.Support;
                sp.drag(me);
                sp.resize(me);
                sp.contextmenu(me);
                sp.cacheCmp(me);
                sp.animShow(me);

            })
        },

        config:{
            file:null
        },
        html:'<center><font size="6">单击此处修改文字<br>双击移动</font></center>',
        style:{
            position:'absolute',
            border:'2px dashed red'
        }
    }
);
